<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">


	<bean id="dataSource2" class="com.mchange.v2.c3p0.ComboPooledDataSource"
		destroy-method="close">
		<property name="driverClass" value="oracle.jdbc.driver.OracleDriver"></property>
		<property name="jdbcUrl" value="jdbc:oracle:thin:@192.168.50.68:1521:test"></property>
		<property name="user" value="vip"></property>
		<property name="password" value="test68"></property>
		<property name="maxPoolSize" value="100"></property>
		<property name="minPoolSize" value="1"></property>
		<property name="initialPoolSize" value="1"></property>
		<property name="maxIdleTime" value="20"></property>
	</bean>

	<bean id="nativeJdbcExtractor" class="org.springframework.jdbc.support.nativejdbc.C3P0NativeJdbcExtractor " /> 
	
    <bean id="oracleLobHandler" class="org.springframework.jdbc.support.lob.OracleLobHandler" lazy-init="true"> 
        <property name="nativeJdbcExtractor"> 
            <ref bean="nativeJdbcExtractor" /> 
        </property> 
    </bean> 

	<bean id="sessionFactory2"
		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"
		scope="singleton">
		<property name="dataSource">
			<ref local="dataSource2" />
		</property>
		<property name="mappingResources">
			<list>
				<#list doc.entitymodel.entity as entity><#t>
				<value>${"${entity.@package_name}"?replace(".","/")}/${entity.@entity_name}.hbm.xml</value>
				</#list>


			</list>
		</property>
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">
					org.hibernate.dialect.OracleDialect
				</prop>
				<prop key="hibernate.show_sql">false</prop>
				<prop key="hibernate.format_sql">false</prop>
				<prop key="hibernate.jdbc.use_streams_for_binary">
					true
				</prop>
				<prop key="hibernate.jdbc.batch_size">0</prop>
			</props>
		</property>
		<property name="lobHandler">
			<ref bean="oracleLobHandler" />
		</property>
	</bean>
	<bean id="jdbcExceptionTranslator2"
		class="org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator">
		<property name="dataSource">
			<ref bean="dataSource2" />
		</property>
	</bean>
	<bean id="hibernateTemplate2" class="org.springframework.orm.hibernate3.HibernateTemplate">
		<property name="sessionFactory">
			<ref bean="sessionFactory2" />
		</property>
		<property name="jdbcExceptionTranslator">
			<ref bean="jdbcExceptionTranslator2" />
		</property>
	</bean>
	<!--
		Transaction manager for a single Hibernate SessionFactory (alternative
		to JTA)
	-->
	<bean id="transactionManager2"
		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory">
			<ref local="sessionFactory2" />
		</property>
	</bean>


	<!-- 配置DAO -->
	<bean id="daoimplTarget" class="com.cus.common.dao.DaoImpl">
		<property name="sessionFactory" ref="sessionFactory2" />
	</bean>

	<bean id="webdao"
		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
		<!-- 配置事务管理器 -->
		<property name="transactionManager" ref="transactionManager" />
		<property name="target" ref="daoimplTarget" />
		<property name="proxyInterfaces" value="com.cus.common.dao.Dao" />
		<!-- 配置事务属性 -->
		<property name="transactionAttributes">
			<props>
				<prop key="*">PROPAGATION_REQUIRED</prop>
			</props>
		</property>
	</bean>
</beans>